<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>商家管理系统</title>
  <link rel="stylesheet" href="${pageContext.request.contextPath}/bootstrap/css/bootstrap.min.css">
  <script src="${pageContext.request.contextPath}/bootstrap/js/jquery-2.1.0.min.js"></script>
  <script src="${pageContext.request.contextPath}/bootstrap/js/bootstrap.min.js"></script>

  <style>
    body {
      background-color: #f5f5f5;
      font-family: "Microsoft YaHei", sans-serif;
    }
    .main-container {
      background-color: white;
      border-radius: 8px;
      box-shadow: 0 2px 10px rgba(0,0,0,0.1);
      padding: 20px;
      margin-top: 20px;
    }
    .search-panel {
      background-color: #f8f9fa;
      padding: 15px;
      border-radius: 6px;
      margin-bottom: 20px;
    }
    .table-header {
      background-color: #f0f3f5;
      font-weight: bold;
    }
    .action-btn {
      padding: 0.3rem 0.6rem;
      font-size: 0.85rem;
      margin-left: 4px;
      border-radius: 4px;
      min-width: 60px;
    }
    .action-col {
      padding-left: 0;
      white-space: nowrap;
      width: 150px;
    }
    .contact-col {
      padding-right: 10px;
      min-width: 120px;
    }
    .table-responsive {
      overflow-x: auto;
    }
    .btn-add {
      margin-left: 10px;
    }
    .btn-sm-custom {
      padding: 0.35rem 0.75rem;
      font-size: 0.875rem;
    }
  </style>
</head>
<body>
<div class="container py-3">
  <div class="main-container">
    <h4 class="mb-4"><i class="glyphicon glyphicon-th-list"></i> 商家管理</h4>

    <!-- 搜索面板 -->
    <div class="search-panel">
      <form class="form-inline">
        <div class="form-group mr-3">
          <label for="merchantName" class="mr-2">商家名称</label>
          <input type="text" class="form-control form-control-sm" id="merchantName" placeholder="输入商家名称">
        </div>
        <div class="form-group mr-3">
          <label for="phone" class="mr-2">联系电话</label>
          <input type="text" class="form-control form-control-sm" id="phone" placeholder="输入联系电话">
        </div>
        <button type="submit" class="btn btn-primary btn-sm-custom mr-2">查询</button>
        <button type="reset" class="btn btn-outline-secondary btn-sm-custom">重置</button>
        <a href="${pageContext.request.contextPath}/shangjia/tiaozhuan" class="btn btn-success btn-sm-custom btn-add">新增商家</a>
      </form>
    </div>

    <!-- 商家表格 -->
    <div class="table-responsive">
      <table class="table table-bordered table-hover table-sm">
        <thead class="table-header">
        <tr>
          <th width="15%">商家编号</th>
          <th width="25%">商家名称</th>
          <th class="contact-col">联系电话</th>
          <th class="action-col">操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${merchantList}" var="merchant">
          <tr>
            <td>${merchant.sid}</td>
            <td>${merchant.sname}</td>
            <td class="contact-col">${merchant.slianxi}</td>
            <td class="action-col">
              <a href="${pageContext.request.contextPath}/shangjia/huixian?id=${merchant.sid}"
                 class="btn btn-warning btn-sm action-btn"> 修改</a>
              <button class="btn btn-danger btn-sm action-btn">
                <a href="${ pageContext.request.contextPath }/shangjia/shan?id=${merchant.sid}">删除</a>
              </button>
            </td>
          </tr>
        </c:forEach>
        </tbody>
      </table>
    </div>
  </div>
</div>
</body>
</html>